home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17436 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: in2.uu.net!zdc!szdc!news
  2. From: braz@ime.usp.br (Rodrigo de Salvo Braz)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP with a simple C Structure
  5. Date: Mon, 15 Apr 1996 17:05:11 GMT
  6. Organization: Zippo
  7. Message-ID: <4ku0v4$lg3@clark.zippo.com>
  8. References: <4jm38u$j1a@news.bellglobal.com>
  9. NNTP-Posting-Host: ddata116.dialdata.com.br
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. >struct Employee
  13. >    {
  14. >    float salary;
  15. >    char department;
  16. >    }
  17.  
  18. >Employee Jim, Paul, Pat, Scott;
  19.  
  20. >void main(void)
  21. >    {
  22. >    Jim.salary=15;
  23. >    Paul.salary=14;
  24. >    Pat.salary=13;
  25. >    Scott.salary=12;
  26.  
  27. >    Jim.department='a';
  28. >    Paul.department='b';
  29. >    Pat.department='c';
  30. >    Scott.department='b';
  31. >    ................................
  32. >    }
  33.  
  34. >I need to replace the dots with a program that tells me who else works
  35. >in Paul's department and how much money he makes.
  36.  
  37. >I would like to have the structure variables named with the name of
  38. >the employee, (instead of an array with the name of the employee as a
  39. >member) so I can easily access their members. The structure can be
  40. >modified, but I really need to be able to have expressions such as
  41. >Jim.salary.
  42.  
  43. >Thank you,
  44. >Bogdan Florescu
  45.  
  46.  
  47. knowing how much he gets seems trivial, just access .salary.
  48.  
  49. A function which tells you who else works there should receive
  50. an employee and some kind of data structure containing ALL
  51. workers, so the function could browse it and compare .department.
  52.  
  53. Cheers,
  54.  
  55. Rodrigo Braz
  56.  
  57.  
  58.